home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 76 / XENIATGM66.iso / Indiana Jones / Indiana Jones.exe / RESOURCE / PREVIEW.GOB / cog_shs_barrel.cog < prev    next >
Text File  |  1999-11-15  |  6KB  |  289 lines

  1. # Jones 3D Cog Script
  2. #
  3. # shs_Barrel.cog     Barrel falls if you take idol.  
  4. #
  5. # [JWC] [RT]
  6. #
  7. # (C) 1998 LucasArts Entertainment Company LLC. All Rights Reserved
  8. #
  9. # ===================================================================
  10.  
  11. symbols
  12.  
  13. message        startup
  14. message        activated
  15. message        damaged
  16. message        touched
  17. message        callback
  18. message        timer
  19. message        entered
  20. message        pulse
  21.  
  22. cog            talkCog                                local
  23.  
  24. keyframe    smashed=in_die_buckle.key            local
  25. keyframe    get=in_pickup_med.key                local
  26.  
  27. #material    brokenweb
  28.  
  29. sound        sndDie=tem_temspikes_up_kill_c.wav    local
  30. sound        sndStop=pru_boulder_crash_c.wav        local
  31. sound        sndBarrel=olv_rockhead_roll_c.wav    local 
  32. sound        sndBrace=tem_tikikey_place_c.wav    local
  33. sound        in_sensetrap=inxj041a.wav           local # Sense a trap. (JC - filename changed)
  34. sound        mus_Cue=mus_gen_danger3.wav    
  35.  
  36. surface        idolspot                            mask=0x408
  37. surface        trigger        
  38. #surface        webOut
  39. #surface        webIn
  40.  
  41. thing        barrel
  42. thing        idol
  43. thing        brace 
  44. thing        bombpos        
  45. thing        posGhost
  46. thing        actorIndy
  47. thing        player                                local
  48. thing        idolitem                            local
  49.  
  50.  
  51. int            done=0                                local    # barrel rolled?
  52. int            rollloop                             local
  53. int            fragment=0                            local
  54. int            i=0                                    local
  55. int            spoken=0                            local
  56. int            vibe=0                                local
  57.  
  58. vector        dir                                    local
  59. vector        posOffset                            local
  60. vector        angOffset                            local
  61.  
  62.  
  63. template    debris=woodshrapa                    local
  64. template    idoltpl=goldidol                    local
  65.  
  66. #SUBROUTINES
  67. flex        roll                                local
  68.  
  69.  
  70. end
  71.  
  72.  
  73. # ===================================================================
  74.  
  75. code
  76.  
  77. startup:
  78.  
  79.     player = GetLocalPlayerThing();
  80.     ClearThingFlags(brace, 0x80);
  81.     ClearThingFlags(barrel, 0x80);
  82.     SetThingLight(idol, '0.2 0.2 0.2', 0.001, 0.01);
  83.     return;
  84.  
  85. # -------------------------------------------------------------------
  86.  
  87. activated:
  88.  
  89.     if ((GetSenderRef() != idolspot) || (done == 1)) return;
  90.  
  91.        if (GetCurItem(player) != 0) return;
  92.  
  93.     done = 1;
  94.  
  95.     MakeMeStop();
  96.     DeselectWeaponWait(player);
  97.  
  98.     StartCutscene(0);
  99.  
  100.     SetExtCamOffset('-0.15 -0.05 0.04');
  101.     SetExtCamLookOffset('0.0 0.02 -0.01');
  102.  
  103.     TeleportThing(player, posGhost);
  104.  
  105.     CaptureThing(player);
  106.     PlayKey(player, get, 5, 0x12, 0);
  107.  
  108.     talkCog = GetCogByIndex(0);
  109.     SendMessage(talkCog, 27);
  110.     
  111.     call roll;
  112.     return;
  113.  
  114. # -------------------------------------------------------------------
  115.  
  116. damaged:
  117.  
  118.     # Make sure player is using whip
  119.     if ((GetSenderRef() != idolspot) || (GetParam(1) != 0x10) || (done == 1)) return;
  120.  
  121.     done = 1;
  122.  
  123.     idolitem = CreateThing(idoltpl, idol);
  124.     CaptureThing(idolitem);
  125.     DestroyThing(idol);
  126.     idol = -1;
  127.  
  128.     dir = VectorAdd(GetThingPos(player), '0.0 0.0 0.3');
  129.     dir = VectorScale(VectorSub(dir, GetThingPos(idolitem)), 0.13);
  130.     ApplyForce(idolitem, dir);
  131.  
  132.     SetTimer(1.5);
  133.  
  134.     call roll;
  135.     return;
  136.  
  137. # -------------------------------------------------------------------
  138.  
  139. touched:
  140.  
  141.     if ((GetSenderRef() != barrel) || (GetSourceRef() != player)) return;
  142.     
  143.     SetCollideType(barrel, 0);
  144.  
  145.     StartCutscene(0);
  146.     SetActorFlags(player, 0x200000);
  147.     StopThing(player);
  148.  
  149.     CopyPlayerHolsters(player, actorIndy);
  150.     CopyOrientAndPos(player, actorIndy);
  151.     SetThingFlags(player, 0x10);  
  152.     ClearThingFlags(actorIndy, 0x80000);  
  153.     
  154.     PlayKey(actorIndy, smashed, 10, 0x14, 0);
  155.     PlaySoundLocal(sndDie, 1.0, 0.0, 0x0, 0);
  156.  
  157.     DamageThing(player, 1000, 0x80, barrel);
  158.  
  159.     ClearActorFlags(player, 0x200000);
  160.     EndCutscene();
  161.  
  162.     return;
  163.  
  164. # -------------------------------------------------------------------
  165.  
  166. callback:
  167.  
  168.     ReleaseThing(player);
  169.  
  170.     if (idol != -1)
  171.     {
  172.         DestroyThing(idol);
  173.         idol = -1;
  174.     }
  175.  
  176.     ChangeInv(player, 36, 10);
  177.     SetInvAvailable(player, 36, 1);
  178.     JonesInvItemChanged(35);
  179.  
  180.     RestoreExtCam();
  181.  
  182.     ClearActorFlags(player, 0x200000);
  183.     EndCutscene();
  184.  
  185.     return;
  186.  
  187. # -------------------------------------------------------------------
  188. entered:
  189.  
  190.     if ((GetSenderRef() == trigger) && (spoken == 0))
  191.     {
  192.         spoken=1;
  193.         PlaySoundLocal(mus_Cue, 1.0, 0.0, 0x0, 0);
  194.         sleep(1);
  195.         PlayVoice(player, in_sensetrap, 1, 0);
  196.     }
  197.     return;
  198.  
  199.  
  200. # -------------------------------------------------------------------
  201. timer:
  202.  
  203.     SetThingVel(idolitem, '0 0 0');
  204.     return;
  205.  
  206. # -------------------------------------------------------------------
  207.  
  208. roll:
  209.  
  210.     SetCollideType(brace, 0);
  211.     MoveToFrame(brace, 1, 4.0);
  212.  
  213.     #kchunk sound
  214.     PlaySoundLocal(sndBrace, 1.0, 0.0, 0x0, 1);
  215.  
  216.     MoveToFrame(barrel, 1, 8.0);
  217.     
  218.     #sound of barrel rolling
  219.     rollloop=PlaySoundLocal(sndBarrel, 1.0, 0.0, 0x1, 0);
  220.     setpulse(.1);
  221.     WaitForStop(barrel);
  222.     
  223.     StopSound(rollloop, 0.0);
  224.     DestroyThing(barrel);
  225.  
  226.     for(i = 0; i < 8; i = i + 1)
  227.     {
  228.         fragment = CreateThing(debris, bombpos);
  229.         SetCollideType(fragment, 0);
  230.         SetThingVel(fragment, VectorScale(VectorAdd(RandVec(), '-0.05 -0.01 0.0'), 1.0));
  231.     }
  232.  
  233.     #sound of barrel explode
  234.     PlaySoundLocal(sndStop, 1.0, 0.0, 0x0, 0);
  235.     setpulse(0.0);
  236.  
  237.     return;
  238.  
  239. # ========================================================================================
  240.             
  241. pulse:
  242.     
  243.         vibe = RandBetween(1, 4);
  244.         if (vibe == 1)
  245.         {
  246.             posOffset = '-0.008 0.00 -0.002'; #1 was .005x
  247.             angOffset = '0.00 -0.002 0.002';
  248.         }
  249.     
  250.         if (vibe == 2)
  251.         {
  252.             posOffset = '0.008 -0.005 0.002'; #2 was .005x
  253.             angOffset = '0.002 0.00 -0.002';
  254.         }
  255.     
  256.         if (vibe == 3)
  257.         {
  258.             posOffset = '0.005 0.005 -0.005'; #3 was .002x
  259.             angOffset = '-0.002 0.005 -0.005';
  260.         }
  261.     
  262.         if (vibe == 4)
  263.         {
  264.             posOffset = '-0.002 0.00 0.005'; #4
  265.             angOffset = '0.00 0.00 0.002';
  266.         }
  267.         
  268.         vibe = RandBetween(1, 3);
  269.         if (vibe == 1)
  270.         {
  271.             SetPulse(0.05);
  272.         }
  273.         if (vibe == 2)
  274.         {
  275.             SetPulse(0.1);
  276.         }
  277.         if (vibe == 3)
  278.         {
  279.             SetPulse(0.15);
  280.         }
  281.  
  282.         SetPOVShake(posOffSet, angOffSet, 200.0, 200.0);
  283.  
  284.     return;
  285.             
  286. # ========================================================================================
  287.  
  288.     end
  289.